From 133ab96180c20e1d5c1556ccd4418e1cbb41dd95 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 3 Apr 2000 08:59:43 +0000 Subject: [PATCH] same as below 2000-03-29 Radek Doulik * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): same as below * gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and height in GdkPixbufAnimation 2000-03-28 Radek Doulik * gdk-pixbuf/io-gif.c (gif_get_lzw): test also for context->frame_done_func and context->anim_done_func to make progressive animation loading work * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): added priv->pixbuf = NULL as pixbuf is now in frame (and to make gdk_pixbuf_loader_prepare happy) (gdk_pixbuf_loader_frame_done): update animation bbox * gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to _GdkPixbufAnimation 2000-03-27 Radek Doulik * gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width instead of width and height --- gdk-pixbuf/ChangeLog | 27 +++++++++++++++++++++++++++ gdk-pixbuf/gdk-pixbuf-animation.c | 2 ++ gdk-pixbuf/gdk-pixbuf-loader.c | 17 +++++++++++++++++ gdk-pixbuf/gdk-pixbuf.h | 3 +++ gdk-pixbuf/io-gif.c | 20 +++++++++++++++----- gtk/gdk-pixbuf-loader.c | 17 +++++++++++++++++ 6 files changed, 81 insertions(+), 5 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 5a5508e2b0..d6328958ee 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -13,6 +13,33 @@ * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Return gboolean instead of int. +2000-03-29 Radek Doulik + + * gdk-pixbuf/gdk-pixbuf-animation.c + (gdk_pixbuf_animation_new_from_file): same as below + + * gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and + height in GdkPixbufAnimation + +2000-03-28 Radek Doulik + + * gdk-pixbuf/io-gif.c (gif_get_lzw): test also for + context->frame_done_func and context->anim_done_func to make + progressive animation loading work + + * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): + added priv->pixbuf = NULL as pixbuf is now in frame (and to make + gdk_pixbuf_loader_prepare happy) + (gdk_pixbuf_loader_frame_done): update animation bbox + + * gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to + _GdkPixbufAnimation + +2000-03-27 Radek Doulik + + * gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width + instead of width and height + 2000-03-27 Owen Taylor * gdk-pixbuf/pixops/pixops.c: Fix problem with diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c index 0577a97c46..3d853954d7 100644 --- a/gdk-pixbuf/gdk-pixbuf-animation.c +++ b/gdk-pixbuf/gdk-pixbuf-animation.c @@ -102,6 +102,8 @@ gdk_pixbuf_animation_new_from_file (const char *filename) animation->ref_count = 1; animation->n_frames = 1; animation->frames = g_list_prepend (NULL, frame); + animation->width = gdk_pixbuf_get_width (pixbuf); + animation->height = gdk_pixbuf_get_height (pixbuf); } else { fseek (f, 0, SEEK_SET); animation = (* image_module->load_animation) (f); diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 56637df75d..777b767d14 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -263,10 +263,27 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) priv = GDK_PIXBUF_LOADER (loader)->private; + priv->pixbuf = NULL; + if (priv->animation == NULL) { priv->animation = g_new0 (GdkPixbufAnimation, 1); priv->animation->n_frames = 0; priv->animation->ref_count = 1; + priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf); + priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf); + } else { + int w, h; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf); + h = gdk_pixbuf_get_height (frame->pixbuf); + + if (w > priv->animation->width) { + priv->animation->width = h; + } + if (h > priv->animation->height) { + priv->animation->height = h; + } } priv->animation->frames = g_list_append (priv->animation->frames, frame); diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h index 01f2043bfc..dc6197891d 100644 --- a/gdk-pixbuf/gdk-pixbuf.h +++ b/gdk-pixbuf/gdk-pixbuf.h @@ -80,6 +80,9 @@ struct _GdkPixbufAnimation { /* List of GdkPixbufFrame structures */ GList *frames; + + /* bounding box size */ + int width, height; }; diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index c4397c497d..926871a3dc 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -669,12 +669,12 @@ gif_get_lzw (GifContext *context) context->pixbuf = gdk_pixbuf_new (ART_PIX_RGB, context->gif89.transparent != -1, 8, - context->width, - context->height); + context->frame_len, + context->frame_height); if (context->prepare_func) (* context->prepare_func) (context->pixbuf, context->user_data); - if (context->animation || context->frame_done_func) { + if (context->animation || context->frame_done_func || context->anim_done_func) { context->frame = g_new (GdkPixbufFrame, 1); context->frame->x_offset = context->x_offset; context->frame->y_offset = context->y_offset;; @@ -696,8 +696,15 @@ gif_get_lzw (GifContext *context) } context->frame->pixbuf = context->pixbuf; if (context->animation) { + int w,h; context->animation->n_frames ++; context->animation->frames = g_list_append (context->animation->frames, context->frame); + w = gdk_pixbuf_get_width (context->pixbuf); + h = gdk_pixbuf_get_height (context->pixbuf); + if (w > context->animation->width) + context->animation->width = w; + if (h > context->animation->height) + context->animation->height = h; } } } @@ -782,7 +789,7 @@ gif_get_lzw (GifContext *context) } done: /* we got enough data. there may be more (ie, newer layers) but we can quit now */ - if (context->animation) { + if (context->animation || context->frame_done_func || context->anim_done_func) { context->state = GIF_GET_NEXT_STEP; } else context->state = GIF_DONE; @@ -821,7 +828,8 @@ gif_get_lzw (GifContext *context) } } - if (context->animation && context->state == GIF_GET_NEXT_STEP) { + if ((context->animation || context->frame_done_func || context->anim_done_func) + && context->state == GIF_GET_NEXT_STEP) { if (context->frame_done_func) (* context->frame_done_func) (context->frame, context->user_data); @@ -1210,6 +1218,8 @@ gdk_pixbuf__gif_image_load_animation (FILE *file) context->animation->ref_count = 1; context->animation->n_frames = 0; context->animation->frames = NULL; + context->animation->width = 0; + context->animation->height = 0; context->file = file; gif_main_loop (context); diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 56637df75d..777b767d14 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -263,10 +263,27 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) priv = GDK_PIXBUF_LOADER (loader)->private; + priv->pixbuf = NULL; + if (priv->animation == NULL) { priv->animation = g_new0 (GdkPixbufAnimation, 1); priv->animation->n_frames = 0; priv->animation->ref_count = 1; + priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf); + priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf); + } else { + int w, h; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf); + h = gdk_pixbuf_get_height (frame->pixbuf); + + if (w > priv->animation->width) { + priv->animation->width = h; + } + if (h > priv->animation->height) { + priv->animation->height = h; + } } priv->animation->frames = g_list_append (priv->animation->frames, frame); -- 2.30.2